#include "UnitManager.h"

UnitManager::UnitManager()
{
   registerUnit(&mDacUnit);
}

void UnitManager::registerUnit(Unit *unit)
{
   mUnits.push_back(unit);
}

Unit* UnitManager::getUnitByName(string name)
{
   for (list<Unit*>::iterator i = mUnits.begin(); i != mUnits.end(); i ++)
   {
      if ((*i)->getName() == name)
         return (*i);
   }
   return NULL;
}

int UnitManager::unitCount()
{
   return mUnits.size();
}

list<Unit*> UnitManager::allUnits()
{
   return mUnits;
}

Unit* UnitManager::getDac()
{
   return &mDacUnit;
}
